package com.syzsn.sk8.repository;

import com.syzsn.sk8.entity.SySK8WorldCupGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SySK8WorldCupGroupRepository extends JpaRepository<SySK8WorldCupGroup, String> {

    @Query(value = "select * from SY_SK8_WORLDCUP_GROUP where WC_ID=?1 order by GROUP_NAME,GROUP_RANK", nativeQuery = true)
    List<SySK8WorldCupGroup> findListByWcId(Integer id);

    @Query(value = "select * from SY_SK8_WORLDCUP_GROUP where WC_ID=?1 and GROUP_RANK=?2", nativeQuery = true)
    List<SySK8WorldCupGroup> findListByWcIdAndRank(Integer wcId, int groupRank);

    @Query(value = "select * from SY_SK8_WORLDCUP_GROUP where WC_ID=?1 and GROUP_NAME=?2 and COUNTRY_ID=?3", nativeQuery = true)
    SySK8WorldCupGroup findOneByParam(Integer wcId, String groupName, String countryId);
}
